home *** CD-ROM | disk | FTP | other *** search
/ An Invitation to the Roland World of Music / Roland - An Invitation To The Roland World Of Music.bin / vb / mmsystem / msgblst1 / main.frm < prev    next >
Text File  |  1995-05-30  |  3KB  |  115 lines

  1. VERSION 2.00
  2. Begin Form frm_main 
  3.    Caption         =   "MIDI Thru"
  4.    ClientHeight    =   3150
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1485
  7.    ClientWidth     =   3420
  8.    Height          =   3555
  9.    Left            =   1035
  10.    LinkTopic       =   "Form2"
  11.    ScaleHeight     =   3150
  12.    ScaleWidth      =   3420
  13.    Top             =   1140
  14.    Width           =   3540
  15.    Begin ListBox lst_OUT_dev 
  16.       Height          =   810
  17.       Left            =   180
  18.       TabIndex        =   2
  19.       Top             =   1920
  20.       Width           =   2895
  21.    End
  22.    Begin ListBox lst_IN_dev 
  23.       Height          =   810
  24.       Left            =   180
  25.       TabIndex        =   1
  26.       Top             =   840
  27.       Width           =   2895
  28.    End
  29.    Begin CheckBox chk_thru 
  30.       Caption         =   "Thru"
  31.       Height          =   315
  32.       Left            =   240
  33.       TabIndex        =   0
  34.       Top             =   240
  35.       Width           =   855
  36.    End
  37.    Begin MsgBlaster MsgBlaster1 
  38.       Prop8           =   "Click on ""..."" for the About Box ---->"
  39.       Prop9           =   "Click on ""..."" for the Message Center --->"
  40.       Left            =   2760
  41.       MsgList         =   MAIN.FRX:0000
  42.       MsgPassage      =   MAIN.FRX:0064
  43.       TargetName      =   ""
  44.       Top             =   240
  45.       UserMsgs        =   MAIN.FRX:0096
  46.       Version         =   "2.2"
  47.    End
  48.    Begin Label lbl_message 
  49.       AutoSize        =   -1  'True
  50.       Caption         =   "Message:"
  51.       Height          =   195
  52.       Left            =   1320
  53.       TabIndex        =   3
  54.       Top             =   300
  55.       Width           =   825
  56.    End
  57. End
  58. Option Explicit
  59. ' This is a example of using MsgBlast to "record" midi messages.
  60.  
  61. Sub chk_thru_Click ()
  62.     If chk_thru.Value = 1 Then ' Checked
  63.         ' Open devices on check
  64.         If midi_out_open() Then
  65.             If midi_in_open(Me.hWnd) Then 'Send all incoming MIDI messages to this form (Me)
  66.                 midi_start_rec
  67.             End If
  68.         End If
  69.     Else ' Unchecked
  70.         ' Close devices on uncheck
  71.         midi_stop_rec
  72.         midi_in_close
  73.         midi_out_close
  74.     End If
  75. End Sub
  76.  
  77. Sub Form_Load ()
  78.     ' Fill listboxes
  79.     init_combo_dev_in lst_IN_dev
  80.     init_combo_dev_out lst_OUT_dev
  81.     
  82.     ' Start trapping of messages to this form (Me)
  83.     MsgBlaster1.hWndTarget = Me.hWnd
  84.     MsgBlaster1.MsgList(0) = MM_MIM_DATA ' Trap only this message
  85. End Sub
  86.  
  87. Sub Form_Unload (Cancel As Integer)
  88.     ' CLose devices (if still open)
  89.     midi_in_close
  90.     midi_out_close
  91.  
  92.     ' Stop trapping
  93.     MsgBlaster1.hWndTarget = 0
  94. End Sub
  95.  
  96. Sub lst_IN_dev_Click ()
  97.     ' Tell the MIDI_IN_MODULE what device to open (On next THRU click)
  98.     Call midi_in_set_dev(lst_IN_dev.ItemData(lst_IN_dev.ListIndex))
  99. End Sub
  100.  
  101. Sub lst_OUT_dev_Click ()
  102.     ' Tell the MIDI_OUT_MODULE what device to open (On next THRU click)
  103.     Call midi_out_set_dev(lst_OUT_dev.ItemData(lst_OUT_dev.ListIndex))
  104. End Sub
  105.  
  106. Sub MsgBlaster1_Message (MsgVal As Integer, wParam As Integer, lParam As Long, ReturnVal As Long)
  107.     ' Send inncoming MIDI message to MIDI OUT
  108.     Call midi_outshort_raw(lParam)
  109.     If lParam <> 248 And lParam <> 254 Then  ' Filter timing messages
  110.         lbl_message.Caption = "Message: " & Hex(lParam)
  111.         ' Remember that "first" MIDI byte is LSB, so the message must be read "backwards"
  112.     End If
  113. End Sub
  114.  
  115.